${r"<#import '/ftlLibrary/properteisVariable.ftl' as pv/>"}
<link href="assets/css/bootstrap-select.css" rel="stylesheet" />
<script src="assets/js/select2/select2.js"></script>
<div class="row">
	<!-- 映射列表 -->
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="leftTree">
		<div class="widget flat radius-bordered">
			<div class="widget-header bg-sky theme">
				<span class="widget-caption">${baseInfo.businessDescription}列表</span>
			</div>
			<div class="widget flat searchCriteria">
                <div class="widget-header bordered-bottom bordered-sky theme-bordered">
                    <span class="widget-caption">筛选区</span>
                    <div class="widget-buttons">
                   		<!-- 业务按钮 begin -->
                   		<label class="businessBtns">
	                   		<button class="btn btn-info shiny search"><i class="fa fa-search"></i>搜索</button>
							<button class="btn btn-success shiny add" serializeNum="${r"${serializeNum}"}" editUrl="${r"${editUrl}"}"><i class="fa fa-plus"></i>新增</button>
							<button class="btn btn-magenta shiny update" serializeNum="${r"${serializeNum}"}" editUrl="${r"${editUrl}"}"><i class="fa fa-pencil"></i>修改</button>
							<button class="btn btn-danger shiny batchDelete" serializeNum="${r"${serializeNum}"}" batchDeleteUrl="${r"${batchDeleteUrl}"}"><i class="fa fa-pencil"></i>删除</button>
							<button class="btn btn-palegreen shiny download"><i class="fa fa-download"></i>导出</button>
                   		</label>
                   		<!-- 业务按钮 end -->
                   		<!-- 面板控制按钮 begin -->
                        <a href="#" data-toggle="collapse"><i class="fa red fa-minus"></i></a>
                        <a href="#" data-toggle="config"><i class="fa red fa-cog"></i></a>
                   		<!-- 面板控制按钮 end -->
                    </div><!--Widget Buttons-->
                </div><!--Widget Header-->
                <div class="widget-body" style="display: block;">
                    <div class="search_Bar">
						<form id="${r"${searchFormId}"}" action="${r"${actionUrl}"}" method="POST">
							<table class="searchAreaTable">
								<tbody>
									<tr>
										<!-- 条件属性,所有条件放在一行,系统自动计算每一行展示的条件属性个数 -->
										<#list table.columns as column>
										<#if column.isSearchable>
										<#if (column.isForeignKey??)?string(column.isForeignKey?string("yes","no"),"no")=="yes" && column.referenceTableSearchColumns?? && column.referenceTableSearchColumns?size gt 0>
										<#--外键-->
										<#list column.referenceTableSearchColumns as searchColumn>
										<#list table.foreignKeys as refTable>
										<#if refTable.referenceTableName==column.referenceTable>
										<th><label>${searchColumn.remarks}</label></th>
										<#if column.columnJavaType=="java.sql.Timestamp"||column.columnJavaType=="java.util.Date">
										<#-- 时间类型-->
										<td>
											<div class="beginValueDiv">
												<input id="d4311" type="text" name="${refTable.standardReferenceColumnNameMappingName}.${searchColumn.columnJavaFieldName}_begin" class="beginValue Wdate" value="${r"${search_map."+refTable.standardReferenceColumnNameMappingName+"."+searchColumn.columnJavaFieldName+"_begin[0]}"}"
												onFocus="WdatePicker({doubleCalendar:true,maxDate:'#F{$dp.$D(\'d4312\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="起始时间" >
											</div>
											<div class="endValueDiv">
												<input id="d4312"  type="text" name="${refTable.standardReferenceColumnNameMappingName}.${searchColumn.columnJavaFieldName}_end" class="endValue Wdate"  value="${r"${search_map."+refTable.standardReferenceColumnNameMappingName+"."+searchColumn.columnJavaFieldName+"_begin[0]}"}"
												onFocus="WdatePicker({doubleCalendar:true,minDate:'#F{$dp.$D(\'d4311\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="结束时间" >
											</div>
										</td>
										<#elseif column.columnJavaType=="java.lang.Boolean"||column.columnJavaType=="boolean">
										<#-- 单选类型-->
										<td>
											<select name="${refTable.standardReferenceColumnNameMappingName}.${searchColumn.columnJavaFieldName}" class="selectpicker" data-live-search="true">
												<optgroup label="选择" data-icon="icon-ok">
														<option value="">所有</option>
														<option value="1">是</option>
														<option value="0">否</option>
													</optgroup>
											</select>
											<script type="text/javascript">
												$("[name='${refTable.standardReferenceColumnNameMappingName}.${searchColumn.columnJavaFieldName}']").val("${r"${search_map."+refTable.standardReferenceColumnNameMappingName+"."+searchColumn.columnJavaFieldName+"[0]}"}");
											</script>
										</td>
										<#else>
										<td><input type="text" name="${refTable.standardReferenceColumnNameMappingName}.${searchColumn.columnJavaFieldName}" value="${r"${search_map."+refTable.standardReferenceColumnNameMappingName+"."+searchColumn.columnJavaFieldName+"[0]}"}"></td>
										</#if>
										</#if>
										</#list>
										</#list>
										<#else>
										<th><label>${column.remarks}</label></th>
										<#if column.columnJavaType=="java.sql.Timestamp"||column.columnJavaType=="java.util.Date">
										<#-- 时间类型-->
										<td>
											<div class="beginValueDiv">
												<input id="d4311" type="text" name="${column.columnJavaFieldName}_begin" class="beginValue Wdate" value="${r"${search_map."+column.columnJavaFieldName+"_begin[0]}"}"
												onFocus="WdatePicker({doubleCalendar:true,maxDate:'#F{$dp.$D(\'d4312\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="起始时间" >
											</div>
											<div class="endValueDiv">
												<input id="d4312"  type="text" name="${column.columnJavaFieldName}_end" class="endValue Wdate"  value="${r"${search_map."+column.columnJavaFieldName+"_begin[0]}"}"
												onFocus="WdatePicker({doubleCalendar:true,minDate:'#F{$dp.$D(\'d4311\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="结束时间" >
											</div>
										</td>
										<#elseif column.columnJavaType=="java.lang.Boolean"||column.columnJavaType=="boolean">
										<#-- 单选类型-->
										<td>
											<select name="${column.columnJavaFieldName}" class="selectpicker" data-live-search="true">
												<optgroup label="选择" data-icon="icon-ok">
														<option value="">所有</option>
														<option value="1">是</option>
														<option value="0">否</option>
													</optgroup>
											</select>
											<script type="text/javascript">
												$("[name='${column.columnJavaFieldName}']").val("${r"${search_map."+column.columnJavaFieldName+"[0]}"}");
											</script>
										</td>
										<#else>
										<td><input type="text" name="${column.columnJavaFieldName}" value="${r"${search_map."+column.columnJavaFieldName+"[0]}"}"></td>
										</#if>
										</#if>
										</#if>
										</#list>
									</tr>
								</tbody>
							</table>
						</form>
					</div>
               </div><!--Widget Body-->
            </div><!--Widget-->
			<div class="widget-body no-padding">
				<div class="topPagingBar">
					${r"${pagingBar}"}
				</div>
				<div class="table-scrollable">
					<!-- 数据表列信息列表 -->
					<table class="table table-bordered dataTable">
						<thead>
							<tr>
								<th title="选择" class="checkboxColumnTh fixedColumn " fixed-align="left">
									<div class="checkbox">
	                                    <label>
	                                        <input type="checkbox" class="chkAll">
	                                        <span class="text"></span>
	                                    </label>
	                                </div>
								</th>
								<th title="属性名">序号</th>
								<#list table.columns as column>
								<#if (column.isForeignKey??)?string(column.isForeignKey?string("yes","no"),"no")=="yes" && column.referenceTableShowColumns?? && column.referenceTableSearchColumns?size gt 0>
								<#--外键-->
								<#list column.referenceTableShowColumns as searchColumn>
								<#list table.foreignKeys as refTable>
								<#if refTable.referenceTableName==column.referenceTable>
								<th title="${searchColumn.remarks}">${searchColumn.remarks}</th>
								</#if>
								</#list>
								</#list>
								<#else>
								<th title="${column.remarks}">${column.remarks}</th>
								</#if>
								</#list>
								<th class="fixedColumn" style="width: 100px">操作</th>
							</tr>
						</thead>
						<tbody>
							${r"<#if page_bean.list?size==0>"}
								<tr>
									<td align="center">无数据</td>
								</tr>
							${r"</#if>"}
							${r"<#list page_bean.list as data>"}
								<tr>
									<td class="checkboxColumnTd">
										<div class="checkbox">
		                                    <label>
		                                    	<#list table.columns as column>
												<#-- 主键-->
												<#if column.isPrimaryKey>
		                                        <input type="checkbox" class="chk"  name="id" value="${r"${data."+column.columnJavaFieldName+"}"}">
												</#if>
												</#list>
		                                        <span class="text"></span>
		                                    </label>
		                                </div>
									</td>
									<td>${r"${data_index+1+(page_bean.pageNo-1)*page_bean.pageSize}"}</td>
									<#list table.columns as column>
									<#if column.isForeignKey??&&column.isForeignKey&&column.referenceTableShowColumns??>
									<#--外键列-->
									<#list column.referenceTableShowColumns as searchColumn>
									<#list table.foreignKeys as refTable>
									<#if refTable.referenceTableName==column.referenceTable>
									<td>${r"${(data."+refTable.standardReferenceColumnNameMappingName+"."+searchColumn.columnJavaFieldName+"???string(data."+refTable.standardReferenceColumnNameMappingName+"."+searchColumn.columnJavaFieldName+"?html,\"\"))!'未设置'}"}</td>
									</#if>
									</#list>
									</#list>
									<#elseif column.columnJavaType=="java.lang.Boolean"||column.columnJavaType=="boolean">
									<td>${r"${data."+column.columnJavaFieldName+"?string('是','否')}"}</td>
									<#else>
									<td>${r"${(data."+column.columnJavaFieldName+"???string(data."+column.columnJavaFieldName+"?html,\"未设置\"))!'未设置'}"}</td>
									</#if>
									</#list>
									<td align="center">	
									<#list table.columns as column>
									<#-- 主键-->
									<#if column.isPrimaryKey>
									<a class="btn btn-default btn-xs icon-only green update" href="javascript:void(0);"  serializeNum="${r"${serializeNum}"}" editUrl="${r"${editUrl}"}" targetDataId="${r"${data."+column.columnJavaFieldName+"}"}"><i class="fa  fa-edit"></i></a>
									<a class="btn btn-default btn-xs icon-only red delete" href="javascript:void(0);"   serializeNum="${r"${serializeNum}"}" deleteUrl="${r"${deleteUrl}"}" targetDataId="${r"${data."+column.columnJavaFieldName+"}"}"><i class="fa fa-trash-o"></i></a>
									</#if>
									</#list>
									</td>
								</tr>
							${r"</#list>"}
						</tbody>
					</table>
				</div>
				 ${r"${pagingBar}"}
			</div>
		</div>
	</div>
</div>
<script>
$(".selectpicker").select2();
</script>